﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using SharpKit.JavaScript;
using SharpKit.SetOnX;

namespace SharpKit.Onx.Playground.Recipes.SetOnX
{
    [JsType(Mode = JsMode.Global, Filename = "../../res/SetOnXHelloWorld.js")]
    public class HelloWorld : OnxContextBase
    {
        [JsMethod(GlobalCode = true)]
        static void Configure()
        {
            //Turn on screen when driving
            Device.ModeOfTransport.Changed += (signal) =>
            {
                if (signal.Current == ModeOfTransportType.Driving)
                {
                    var msg = new SetOnXMessage 
                    {
                         Message = SetOnXMessageType.Screen,
                         On = BooleanEnum.True
                    };
                    Device.Applications.Launch("setonx", msg, null);
                };
            };
        }
    }
}